//
//  DCDownloadConst.h
//  DCDownloadOpration
//
//  Created by Wade on 16/3/30.
//  Copyright © 2016年 Wade. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef  enum{
    DCDonloadTypeNone =0,// 默认值 不下载
    DCDonloadTypeURL,// 直接URL下载
    DCDonloadTypeOSS// OSS服务器下载
}DCDonloadType;


/**
 *  计算MD5值的单位大小
 */
static NSInteger  CPFileHashDefaultChunkSize = 1024 * 8;
/**
 *  所有回调的Block定义
 */
typedef void(^CPDonwloadCompliction)(NSError *error);
typedef void(^CPDownloadProgress)(NSInteger currentLength,NSInteger totalLength,float pro);

/**
 *  解压/解密进度回调
 *
 *  @param pro pro = -1表示解压/解密失败
 */
typedef void(^CPDownloadUnzipProgress)(float pro);

/**
 *  标注下载进程的下载状态
 */
typedef NS_ENUM(NSInteger,DCDownloadState) {
    /**
     *  没有任务状态
     */
    DCDownloadStateNone = 0,
    /**
     *  等待下载状态=
     */
    DCDownloadStateWaiting = 1,
    /**
     *  下载中 接受数据
     */
    DCDownloadStateResumed = 2,
    /**
     *  暂停
     */
    DCDownloadStateSuspened = 3,
    /**
     *  完成
     */
    DCDownloadStateCompleted = 4,
    /**
     *  下载失败
     */
    DCDownloadStateFail = 5
}NS_ENUM_AVAILABLE_IOS(2_0);

/** 存放所有的文件大小 */
static NSMutableDictionary *_totalFileSizes;
/** 存放所有的文件大小的文件路径 */
static NSString *_totalFileSizesFile;

/** 根文件夹 */
static NSString * const DCDownloadRootDir = @"DCDefaultdownload";

/** 默认manager的标识 */
static NSString * const DCDowndloadManagerDefaultIdentifier = @"DCDefaultdownloadIdentifier";

/******** 通知 Begin ********/
/** 下载进度发生改变的通知 */
extern NSString * const DCDownloadProgressDidChangeNotification;
/** 下载状态发生改变的通知 */
extern NSString * const DCDownloadStateDidChangeNotification;

extern NSString * const DCDownloadStateDidComplitionNotification;

/** 利用这个key从通知中取出对应的MJDownloadInfo对象 */
extern NSString * const DCDownloadInfoKey;

#define DCDownloadNoteCenter [NSNotificationCenter defaultCenter]

#define DCDocumentPath [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject]

#define DCCachesPath [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject]

#define DCDefaultCachePath [[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:DCDownloadRootDir]


@interface DCDownloadConst : NSObject

@end
